package com.example.demo.test;

import com.example.demo.test.ListComparable.Student;

import java.util.ArrayList;
import java.util.List;

public class demo5 {
    static void Test1(){
        Student student = new Student("李斯", 1);
        Student student2 = new Student("张三", 5);
        Student student3 = new Student("王五", 2);
        List<Student> students = new ArrayList<Student>();
        students.add(student);
        students.add(student2);
        students.add(student3);

        List<Student> students1 = students.subList(0, 2);
//        for (Student student1 : students1) {
//            System.out.println(student1.getAge());
//        }

        students1.add(new Student("掌声",14));

        for (Student s :
                students) {
            System.out.println(s.getAge());
        }

    }
    public static void main(String[] args) {
        Test1();
    }


}
